<?php
    $attribute = pc_variable("attribute");
    $name = pc_variable("name");
    $value = pc_variable("value"); 
    pc_echo("</fieldset>", 0, false, false);
?>
<fieldset>
    <legend><?php pc_echo(pc_message("field." . $name)); ?></legend>
    <?php
        foreach($attribute->getAttributes() as $subname => $subattribute) {
            pc_pagelet("show-entity/attribute/switch", array(
                "attribute" => $subattribute,
                "name" => $name . "." . $subname,
                "value" => $value !== null ? $value->get($subname) : null
            ));
        }
    ?>
</fieldset>
<?php pc_echo("<fieldset>", 0, false, false); ?>